from typing import List

from PyQt6.QtCore import QRectF, QLineF, Qt
from PyQt6.QtGui import QPainter


class Route:
    def __init__(self, unit, path_set: List):
        self.unit = unit
        self.path_set = path_set

    def draw(self, painter: QPainter, width: float):
        points = [
            QRectF(col * width, row * width, width, width).center()
            for (row, col) in self.path_set
        ]

        i = 1
        while i < len(points):
            line = QLineF(points[i-1], points[i])
            painter.drawLine(line)
            i += 1
